use(["public/javascripts/service/billManageService.js","public/javascripts/widget/slider/slider.js","public/javascripts/widget/calander/calander.js","public/common/classNames.js","public/javascripts/widget/select/select.js"], function(billManageService,SliderComponent,Calander,classNames,selectFactory) {

    var cx = classNames;

    var PageComponent = React.createClass({
        componentWillMount: function() {
            for(var i in billManageService) this[i] = billManageService[i].bind(this);
            var beginDate =new Date().getLastMonth().start,
                endDate =new Date().getLastMonth().end;

            this.search({startEffectTime:beginDate,endEffectTime:endDate});
        },
        componentDidMount : function(){
            var self = this;
            Calander.init({ele: ['#start-time',"#end-time"],isClear:true});
            $("#start-time").change(function(e){
                self.refs.starttime.setValue(e.target.value);
            });
            $("#end-time").change(function(e){
                self.refs.endtime.setValue(e.target.value);
            });

            self.refs.starttime.setValue(new Date().getLastMonth().start);
            self.refs.endtime.setValue(new Date().getLastMonth().end);

            this.getStatusList();
        },
        getInitialState: function () {
            return {total : 0, selectItem : {},dialog:{},msg:{}, cusId : billManageService.cookie(),primary : billManageService.isPrimary()};
        },
        render:function() {
            var list = this.state.list ? this.state.list : [], Browser = typeof window != 'undefined',
                selectItem = this.state.selectItem,
                component = this,
                cusId = this.state.cusId,
                total = this.state.total,
                status = this.state.status,
                primary = this.state.primary,
                msg = this.state.msg,
                dialog = this.state.dialog;
                console.log(primary, 'primary')
            return ~init;
        }
    });
    if(typeof ReactDOM != "undefined") {
        ReactDOM.render(<PageComponent data={storage}/>, document.getElementById('container'));
    }
    module.exports = PageComponent;
});
